package mh.util;

/**
 * A generic class that connect together two object, forming a pair.
 * 
 * @author Gianmarco
 * 
 * @param <A>
 *            The type of the first element
 * @param <B>
 *            The type of the second element
 */
public class Pair<A, B> {
	private A	a;
	private B	b;

	/**
	 * Standard constructor
	 * 
	 * @param aa
	 *            First element
	 * @param bb
	 *            Second element
	 */
	public Pair(A aa, B bb) {
		this.a = aa;
		this.b = bb;
	}

	/**
	 * Returns the first element of the pair.
	 * 
	 * @return An object of the type declared
	 */
	public A getLeft() {
		return this.a;
	}

	/**
	 * Returns the second element of the pair.
	 * 
	 * @return An object of the type declared
	 */
	public B getRight() {
		return this.b;
	}

	/**
	 * Set the value of the left element of the pair
	 * 
	 * @param aa
	 *            The new value
	 */
	public void setLeft(A aa) {
		this.a = aa;
	}

	/**
	 * Set the value of the right element of the pair
	 * 
	 * @param bb
	 */
	public void setRight(B bb) {
		this.b = bb;
	}

	@Override
	public String toString() {
		return this.a.toString();
	}
}
